package com.newdjk.newdoctor.net;

import com.newdjk.newdoctor.MyApplication;
import com.newdjk.newdoctor.entity.AppEntity;
import com.newdjk.newdoctor.entity.CityEntity;
import com.newdjk.newdoctor.entity.GoodShareEntity;
import com.newdjk.newdoctor.entity.PatientListEntity;
import com.newdjk.newdoctor.entity.QueryOrgInfoEntity;
import com.newdjk.newdoctor.entity.UploadImageEntity;
import com.newdjk.okhttp.RetrofitFactory;
import com.newdjk.okhttp.entity.ADentity;
import com.newdjk.okhttp.entity.AboutUsEntity;
import com.newdjk.okhttp.entity.ActivityListEntity;
import com.newdjk.okhttp.entity.AreaEntity;
import com.newdjk.okhttp.entity.BannerInfoEntity;
import com.newdjk.okhttp.entity.BaseEntity;
import com.newdjk.okhttp.entity.DoctorInfoEntity;
import com.newdjk.okhttp.entity.GetDoctorQrcodeEneity;
import com.newdjk.okhttp.entity.HeduiTiaopeiEntity;
import com.newdjk.okhttp.entity.HomeTabRedEntity;
import com.newdjk.okhttp.entity.HotShopEntity;
import com.newdjk.okhttp.entity.LocationEntity;
import com.newdjk.okhttp.entity.Login;
import com.newdjk.okhttp.entity.MedicationCompanyEntity;
import com.newdjk.okhttp.entity.OrderListEntity;
import com.newdjk.okhttp.entity.OrganizationInfoEntity;
import com.newdjk.okhttp.entity.QueryServicePackDetailEntity;
import com.newdjk.okhttp.entity.RegisterEntity;
import com.newdjk.okhttp.entity.ShenFangEntity;
import com.newdjk.okhttp.entity.ShopListEntity;
import com.newdjk.okhttp.entity.SpecialAdviceEntity;
import com.newdjk.okhttp.entity.SystemListEntity;
import com.newdjk.okhttp.entity.UnreadMessageEntity;
import com.newdjk.okhttp.entity.VerfyCodeEntity;
import com.newdjk.okhttp.entity.YunyiYouxuanEntity;
import com.newdjk.okhttp.entity.ZhuangxiutEntity;

import java.util.List;
import java.util.Map;

import cn.jpush.android.api.JPushInterface;
import io.reactivex.Observable;
import okhttp3.RequestBody;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Header;
import retrofit2.http.HeaderMap;
import retrofit2.http.Headers;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;


/*
 *  @项目名：  RetrofitRxjavaDemo
 *  @包名：    com.example.huhai.retrofitrxjavademo.net
 *  @文件名:   NetServices
 *  @创建者:   EDZ
 *  @创建时间:  2018/11/1 10:48
 *  @描述：
 */
public interface NetServices {
    public static String SSOAPI = "/SSOAPI";//		医生  SSO接口	登录以及接口授权认证相关接口
    public static String PlatFormAPI = "/PlatFormAPI";//	平台接口	包含用户、病人、角色权限、服务包以及知识库等各公共模块接口
    public static String PurchaseAPI = "/PurchaseAPI";//	平台接口	包含用户、病人、角色权限、服务包以及知识库等各公共模块接口
    public static String Doctor = PlatFormAPI + "/Doctor";
    public static String Prescprition = "/Prescription";
    public static String DoctorPatient = PlatFormAPI + "/DoctorPatient";
    public static String ActivityAPI = "/ActivityAPI";
    public static String AdAPI = "/AdAPI";
    public static String Pharmacy = "/Pharmacy";


    class Factory {

        private static NetServices mFlowChatService;

        public static NetServices create() {
            return mFlowChatService = RetrofitFactory.getRetrofitFactory().create(NetServices.class);
        }

        public static NetServices getService() {
            return mFlowChatService;
        }
    }

    @FormUrlEncoded
    @POST(SSOAPI + "/Doctor/Login")
    Observable<BaseEntity<Login>> login(
            @HeaderMap Map<String, String> headers,
            @Field("Mobile") String phone,
            @Field("Code") String password,
            @Field("Type") String type
    );


    @GET(PurchaseAPI + "/Purchase/QueryDoctorIdentify")
    Observable<BaseEntity<DoctorInfoEntity>> QueryDoctorIdentify(
            @Query("DrId") String DrId
    );

    @FormUrlEncoded
    @POST(Doctor + "/SendMobileCode")
    Observable<BaseEntity> SendMobileCode(
            @Field("Mobile") String phone

    );

    @FormUrlEncoded
    @POST(SSOAPI + "/PassPort/Logout")
    Observable<BaseEntity> Logout(
            @Field("Token") String phone

    );

    @FormUrlEncoded
    @POST(PurchaseAPI + "/Purchase/ClinicRegister")
    Observable<BaseEntity> ClinicRegister(
            @Field("CompanyName") String CompanyName,
            @Field("Mobile") String Mobile,
            @Field("MobileCode") String MobileCode,
            @Field("ProvinceId") String ProvinceId,
            @Field("ProvinceName") String ProvinceName,
            @Field("CityId") String CityId,
            @Field("CityName") String CityName,
            @Field("AreaId") String AreaId,
            @Field("AreaName") String AreaName,
            @Field("RecommenderId") String RecommenderId,
            @Field("Area") String Area,
            @Field("RegType") String RegType
    );

    @GET(PlatFormAPI + "/Area/GetAddressByLocation")
    Observable<BaseEntity<LocationEntity>> GetAddressByLocation(
            @QueryMap(encoded = true) Map<String, String> params
    );

    @GET(PlatFormAPI + "/Area/QueryAreaByName")
    Observable<BaseEntity<AreaEntity>> QueryAreaByName(
            @Query("Name") String Name
    );

    @GET(PlatFormAPI + "/Area/QueryAreaByParentId")
    Observable<BaseEntity> QueryAreaByParentId(
            @Query("ParentId") String ParentId
    );

    @FormUrlEncoded
    @POST(PurchaseAPI + "/Purchase/QueryClinicAccreditationInfo")
    Observable<BaseEntity<RegisterEntity>> QueryClinicAccreditationInfo(
            @Field("DrId") String ParentId
    );


    @FormUrlEncoded
    @POST(PlatFormAPI + "/Resource/UploadImage")
    Observable<BaseEntity<UploadImageEntity>> UploadImage(
            @Field("Base64Str") String Base64Str,
            @Field("Type") String Type);

    @POST(PurchaseAPI + "/Purchase/SaveClinicAccreditation")
    Observable<BaseEntity> SaveClinicAccreditation(
            @Body RequestBody info);

    @FormUrlEncoded
    @POST(Doctor + "/QueryDoctorByMobileCode")
    Observable<BaseEntity<VerfyCodeEntity>> QueryDoctorByMobileCode(
            @Field("Mobile") String Mobile,
            @Field("MobileCode") String MobileCode
    );

    @FormUrlEncoded
    @POST(Doctor + "/ChangeDoctorPassword")
    Observable<BaseEntity> ChangeDoctorPassword(
            @Field("Id") String Id,
            @Field("NewPass") String NewPass,
            @Field("TwoPass") String TwoPass
    );

    @POST(PlatFormAPI + "/KnowledgeBase/GetAboutInfo")
    Observable<BaseEntity<AboutUsEntity>> GetAboutInfo(
    );

    @POST(PlatFormAPI + "/DoctorPatient/AddFeedBack")
    Observable<BaseEntity> AddFeedBack(
            @Body RequestBody info);


    @GET(Prescprition + "/DoctorVisit/QueryDoctorMsgSwitch")
    Observable<BaseEntity> QueryDoctorMsgSwitch(
            @Query("DoctorId") String DoctorId);


    @FormUrlEncoded
    @POST(DoctorPatient + "/QueryDoctorPatientPage")
    Observable<BaseEntity<PatientListEntity>> QueryDoctorPatientPage(
            @Field("DrId") int DrId,
            @Field("PatientId") String PatientId,
            @Field("RelationStatus") String RelationStatus,
            @Field("IsPatientMain") String IsPatientMain,
            @Field("IsDrKey") String IsDrKey,
            @Field("PatientName") String PatientName,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize
    );

    @POST(PlatFormAPI + "/Memberfeatures/SendGroupMessage")
    Observable<BaseEntity> SendGroupMessage(
            @Body RequestBody info);


    @GET(Prescprition + "/Pharmacy/GetMedicationCompanyByDrId")
    Observable<BaseEntity<MedicationCompanyEntity>> GetMedicationCompanyByDrId(
            @Query("DoctorId") String DoctorId,
            @Query("MedicationType") String MedicationType);

    @GET(PlatFormAPI + "/OrganizationInfo/QueryOrganizationInfoByOrgId")
    Observable<BaseEntity<OrganizationInfoEntity>> QueryOrganizationInfoByOrgId(
            @Query("OrgId") int DoctorId,
            @Query("AccountId") int AccountId);

    @GET(PlatFormAPI + "/KnowledgeBase/GetAppManage?AppCode=newdjkorgapp")
    Observable<BaseEntity<AppEntity>> GetAppManage();


    @POST(ActivityAPI + "/GroupBuy/SendWXMessageToPatient")
    Observable<BaseEntity> SendWXMessageToPatient(
            @Body RequestBody info);


    @POST(PlatFormAPI + "/SpecialistHosGroup/SendGoodsRecommend")
    Observable<BaseEntity> SendGoodsRecommend(
            @Body RequestBody info);

    @FormUrlEncoded
    @POST(PlatFormAPI + "/SpecialistHosGroup/GetGoodsRecommendInfo")
//获取推荐详情页面信息
    Observable<BaseEntity<GoodShareEntity>> GetGoodsRecommendInfo(
            @Field("DataSource") int DataSource,
            @Field("DataId") int DataId);

    @GET(Doctor + "/GetDoctorRecommendCode")
//获取推荐详情页面信息
    Observable<BaseEntity<GetDoctorQrcodeEneity>> GetDoctorRecommendCode(
            @Query("DrId") int DataId);

    @GET(Doctor + "/QueryOrgAndImgByDrId")
//获取医生id获取关联机构信息
    Observable<BaseEntity<QueryOrgInfoEntity>> QueryOrgAndImgByDrId(
            @Query("DrId") int DataId);

    @POST(Doctor + "/SaveOrg")
//获取医生id获取关联机构信息
    Observable<BaseEntity> SaveOrg(
            @Body RequestBody info);

    @GET(PlatFormAPI + "/ServicePackItem/QueryServicePackDetailByPackId")
//获取推荐详情页面信息
    Observable<BaseEntity<List<QueryServicePackDetailEntity>>> QueryServicePackDetailByPackId(
            @Query("ServicePackId") int ServicePackId);

    @FormUrlEncoded
    @POST(SSOAPI + "/PassPort/VerifyToken")
//获取医生id获取关联机构信息
    Observable<BaseEntity> VerifyToken(
            @Field("Token") String Token);


    @GET(PurchaseAPI + "/Purchase/GetUnReadNumByDrId")
//根据医生Id获取药品采购子订单消息未读数量
    Observable<BaseEntity<Integer>> GetUnReadNumByDrId(
            @Query("DrId") String DrId);



    //根据查询条件分页获取药品采购子订单消息
    @FormUrlEncoded
    @POST(PlatFormAPI + "/OrgAppMessage/GetOrgAppOrderMessagePage")
    Observable<BaseEntity<OrderListEntity>> GetPurchaseSubOrderMessagePage(
            @Field("DrId") String DrId,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize
    );

    @FormUrlEncoded
    @POST(PlatFormAPI + "/OrgAppMessage/UpdateOrgAppOrderMessageRead")
    Observable<BaseEntity<Boolean>> UpdatePurchaseSubOrderMessageRead(
            @Field("DrId") String DrId,
            @Field("RelationType") int RelationType,
            @Field("PurchaseSubOrderId") String PurchaseSubOrderId
    );

    @GET(AdAPI + "/Ads/QueryAdsList")
    Observable<BaseEntity<List<BannerInfoEntity>>> QueryAdsList(
            @Query("classId") String classId
    );


    @FormUrlEncoded
    @POST(PurchaseAPI + "/Purchase/GetMyMedicationCompanyList")
    Observable<BaseEntity<ShopListEntity>> GetMyMedicationCompanyList(
            @Field("DrId") String DrId,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize
    );

    @FormUrlEncoded
    @POST(PurchaseAPI + "/Purchase/ChangeMyMedicationCompany")
    Observable<BaseEntity> ChangeMyMedicationCompany(
            @Field("DrId") String DrId,
            @Field("MedicationCompanyId") String MedicationCompanyId
    );


    //医生审方数量
    @FormUrlEncoded
    @POST(Prescprition + "/ApplyPrescription/GetApplyPreListOfAuditor")
    Observable<BaseEntity<ShenFangEntity>> GetApplyPreListOfAuditor(
            @Field("DoctorId") String DrId,
            @Field("PageIndex") int PageIndex,
            @Field("QueryStatus") int status,
            @Field("PatientName") String name,
            @Field("PageSize") int PageSize);

    //调配核对
    @FormUrlEncoded
    @POST(Prescprition + "/ApplyPrescription/GetApplyPreListOfChecker")
    Observable<BaseEntity<HeduiTiaopeiEntity>> GetApplyPreListOfChecker(
            @Field("DoctorId") String DrId,
            @Field("PageIndex") int PageIndex,
            @Field("QueryStatus") int status,
            @Field("PatientName") String name,
            @Field("PageSize") int PageSize);




    //调配核对
    @POST(Prescprition + "/ApplyPrescription/GetApplyPreStatusCount")
    Observable<BaseEntity<List<HomeTabRedEntity>>> GetApplyPreStatusCount(
            @Body RequestBody info);


    @GET(PlatFormAPI + "/OrgAppMessage/GetUnReadNumByDrId")
    Observable<BaseEntity<UnreadMessageEntity>> OrgAppMessageGetUnReadNumByDrId(
            @Query("DrId") String classId
    );

    //根据查询条件分页获取药品采购子订单消息
    @FormUrlEncoded
    @POST(PlatFormAPI + "/OrgAppMessage/GetOrgAppSystemMessagePage")
    Observable<BaseEntity<SystemListEntity>> GetOrgAppSystemMessagePage(
            @Field("DrId") String DrId,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize
    );

    @FormUrlEncoded
    @POST(PlatFormAPI + "/OrgAppMessage/UpdateOrgAppSystemMessageRead")
    Observable<BaseEntity<Boolean>> UpdateOrgAppSystemMessageRead(
            @Field("DrId") String DrId,
            @Field("RelationType") int RelationType,
            @Field("RelationId") int RelationId
    );




    @FormUrlEncoded
    @POST(PurchaseAPI + "/Purchase/QueryChannelPage")
    Observable<BaseEntity<HotShopEntity>> QueryChannelPage(
            @Field("ChannelType") int ChannelType,
            @Field("SupplierId") int SupplierId,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize,
            @Field("AreaId") int AreaId,
            @Field("DrId") int DrId
    );
    @FormUrlEncoded
    @POST(PlatFormAPI + "/ServicePackItem/QueryRecommendPackPagePage")
    Observable<BaseEntity<SpecialAdviceEntity>> QueryRecommendPackPagePage(
            @Field("AreaId") int AreaId,
            @Field("ServiceItemId") int ServiceItemId,
            @Field("IsRecommend") int IsRecommend,
            @Field("FieldType") int FieldType,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize,
            @Field("SortDirection") boolean SortDirection,
            @Field("DrId") int DrId
    );
    @GET(PlatFormAPI + "/SpecialistHosGroup/GetMallChannelList")
    Observable<BaseEntity<List<YunyiYouxuanEntity>>> GetMallChannelList(
            @Query("DrId") int DrId,
            @Query("AreaId") int AreaId
    );


    //根据查询条件分页活动消息
    @FormUrlEncoded
    @POST(PlatFormAPI + "/OrgAppMessage/GetOrgAppActivityMessagePage")
    Observable<BaseEntity<ActivityListEntity>> GetOrgAppActivityMessagePage(
            @Field("DrId") String DrId,
            @Field("PageIndex") int PageIndex,
            @Field("PageSize") int PageSize
    );

    //首页装修及认证
    @GET(Prescprition + "/Pharmacy/GetPharmacyManagerStatus")
    Observable<BaseEntity<ZhuangxiutEntity>> GetPharmacyManagerStatus(
            @Query("DoctorId") String DrId
    );

    //首页广告
    @FormUrlEncoded
    @POST(PurchaseAPI + "/Purchase/SearchAdsNew")
    Observable<BaseEntity<ADentity>> SearchAdsNew(
            @Field("ADPosition") int ADPosition,
            @Field("AreaId") String AreaId,
            @Field("DrId") String DrId
    );

    @FormUrlEncoded
    @POST(PlatFormAPI + "/OrgAppMessage/UpdateOrgAppActivityMessageRead")
    Observable<BaseEntity<Boolean>> UpdateOrgAppActivityMessageRead(
            @Field("DrId") String DrId,
            @Field("RelationType") int RelationType,
            @Field("RelationId") String RelationId
    );
}

